package view;

import java.util.ArrayList;

import utilities.SceneGraphVisitorAdapter2;

import com.jme3.audio.AudioNode;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.SceneGraphVisitor;
import com.jme3.scene.SceneGraphVisitorAdapter;

public class ViewModule {
	
	
	private ArrayList<Node> nodes = new ArrayList<Node>();
	private ArrayList<AudioNode> audioNodes = new ArrayList<AudioNode>();
	private ArrayList<Geometry> geometries = new ArrayList<Geometry>();
	
	public void addNode(Node node) {
		
		final ArrayList<Node> currNodes = new ArrayList<Node>();
		final ArrayList<AudioNode> currAudioNodes = new ArrayList<AudioNode>();
		final ArrayList<Geometry> currGeometries = new ArrayList<Geometry>();
		
		SceneGraphVisitorAdapter2 visitor = new SceneGraphVisitorAdapter2() 
		{
			@Override
			public void visit(Node searchScope) {
				currNodes.add(searchScope);				
			}
			
			@Override
			public void visit(AudioNode searchScope) {
				currAudioNodes.add(searchScope);
			}
			
			@Override
			public void visit(Geometry searchScope) {
				currGeometries.add(searchScope);
			}
		};
		
		node.breadthFirstTraversal(visitor);
		
		nodes.addAll(currNodes);
		audioNodes.addAll(currAudioNodes);
		geometries.addAll(currGeometries);
	}
	
	public ArrayList<Node> getNodes() {
		return this.nodes;
	}
	
	public ArrayList<AudioNode> getAudioNodes() {
		return this.audioNodes;
	}
	
	public ArrayList<Geometry> getGeometries() {
		return this.geometries;
	}
	
	
	

}
